<template>
  <div class="aftersaleinfo">
    <div class="bg">
      <div class="center">
        <van-image :src="require('../../assets/img/home/Tick.png')" fit="cover"></van-image>
        <p>提交成功！</p>
      </div>

    </div>
    <div class="commonBox">
      <van-cell-group class="products" :border="false">
        <div v-for="(item, index) in product" :key="index">
          <van-card class="product" v-for="(items, indexs) in item.detailinfo" :key="indexs" :num="items.quantity" :desc="items.p_s_name" :title="items.product_name" :thumb="`${resourceURL}${items.cover_url}`">
            <template #price>
              <div v-if="order.order_type==1">￥{{items.sale_price}}</div>
              <div v-if="order.order_type==2">{{items.growth_coin}}积分</div>
            </template>
          </van-card>
        </div>

        <div class="desbox">
          <div class="desone">
            <div class="destitle">订单编号</div>
            <div class="desnum">{{order.orderno}}</div>
          </div>
          <div class="desone">
            <div class="destitle">创建时间</div>
            <div class="desnum">{{order.order_time}}</div>
          </div>
          <div class="desone">
            <div class="destitle">付款时间</div>
            <div class="desnum">{{order.pay_time}}</div>
          </div>
        </div>
      </van-cell-group>
    </div>
    <div class="submit">
      <van-button type="primary" class="btn" round plain block @click="$router.replace('/')">返回首页</van-button>

    </div>

  </div>
</template>
<script>
export default {
  data () {
    return {
      order: {},
      product: {},
      id: "",
    };
  },
  created () {
    this.id = this.$route.query.id;
    this.getOrderDetail();
  },
  methods: {
    // 订单详情
    getOrderDetail () {
      this.$axios
        .get(this.$api.getorderdetail, {
          params: {
            order_id: this.id,
          },
        })
        .then((res) => {
          this.order = res.data.data.order;
          this.product = res.data.data.productinfo;
          this.order.order_time = this.$moment(
            Number(this.order.order_time) * 1000
          ).format("YYYY-MM-DD HH:mm");
          this.order.pay_time = this.$moment(
            Number(this.order.pay_time) * 1000
          ).format("YYYY-MM-DD HH:mm");
        });
    },
  },
};
</script>
<style lang='less' scoped>
.btn {
  border: 1px solid #ff7733;
  color: #ff7733;
}
.aftersaleinfo {
  display: flex;
  align-items: center;
  flex-direction: column;
}
.submit {
  position: fixed;
  left: 0;
  bottom: 24px;
  display: flex;
  width: 100%;
  padding: 6px 16px;
  background-color: transparent;
  box-sizing: border-box;
}
.desbox {
  width: 100%;
  border-top: 1px dashed rgba(25, 23, 20, 0.102);
  margin-top: 14px;
  padding-top: 14px;
  .desone {
    width: 100%;
    display: flex;
    justify-content: space-between;
    .destitle {
      font-size: 14px;
      line-height: 18px;
      margin-bottom: 14px;
    }
    .desnum {
      font-size: 14px;
      color: rgba(4, 4, 4, 0.6);
    }
  }
}
.bg {
  width: 100%;

  background: linear-gradient(135deg, #ff7733 0%, #ff4133 100%);
  border-radius: 0px 0px 16px 16px;
  height: 139px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  .center {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: center;
  }
  /deep/ .van-image {
    margin-right: 6px;
    height: 26px;
    width: 26px;
  }
  p {
    margin: 0;
    font-size: 20px;
    font-family: Microsoft YaHei;
    font-weight: bold;

    color: #f9c254;
  }
}
.commonBox {
  width: 343px;
  background: #ffffff;
  border: 1px solid #f2f2f2;
  opacity: 1;
  border-radius: 10px;
  box-sizing: border-box;
  padding: 16px;
  margin-top: 16px;
  .products {
    .shopurl {
      .van-cell__left-icon {
        display: flex;
        align-items: center;
        width: 20px;
        height: 22px;
        margin-right: 8px;
      }
    }
    .product {
      margin-top: 0;
      background-color: #fff;
      /deep/.van-card__title {
        font-size: 14px;
      }
      /deep/ .van-card__price {
        font-size: 14px;
      }
    }
    .one_option_btn {
      display: flex;
      justify-content: flex-end;
      margin: 10px 0 6px;
      /deep/.van-button {
        width: 80px;
        margin-left: 10px;
      }
    }
    .option_btn {
      display: flex;
      justify-content: flex-end;
      padding: 6px 16px 12px;
      /deep/.van-button {
        width: 80px;
        margin-left: 10px;
      }
    }
  }
  .content {
    font-size: 14px;
    color: #303030;
    white-space: wrap;
    padding: 12px 0;
  }
}
</style>